package org.prail.utils;

import org.prail.net.EntityDecoder;

public class StringUtils {
	
	public static String formatXml(final String str) {
		return EntityDecoder.htmlToChar(str
				.replaceAll("</em>", " ")
				.replaceAll("<[^>]+>", "")
				.replaceAll("(\\r|\\n)", "").trim()
				.replaceAll(" +", " "));
	}
	
	public static String fileName(final String fileName) {
		StringBuilder result = new StringBuilder();
        for(int i=0; i<fileName.length(); i++) {
            char tmpChar = fileName.charAt( i );
            if (Character.isLetterOrDigit( tmpChar) || tmpChar == '_' || tmpChar == '-' || tmpChar == ' ' || tmpChar == '.') {
                result.append( tmpChar );
            }
        }
        return result.toString();
	}


}
